@extends('shared.adminBase')
@section('title','添加商品')
@section('content')
    <section class="content-header">
        <h1>添加商品</h1>
        <ol class="breadcrumb">
            <li><a href="{{URL::action('AdminController@innerIndex')}}"><i class="fa fa-dashboard"></i> 首页</a>
            </li>
            <li class="active">添加商品</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <!-- /.box -->
                <div class="box">
                    <!-- /.box-header -->
                    <div class="box-body col-md-12">
                        <form id="form1" action="{{URL::action('GameController@storeProduct')}}"
                              method="post" enctype="multipart/form-data">
                            {{csrf_field()}}
                            <div class="form-group">
                                <label>活动名称<span style="color:red;">&nbsp;*</span></label>
                                <input type="text" name="name" class="form-control" style="width:50%;"
                                       placeholder="请填写商品名称">
                                @if($errors->has('name'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('name')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>商品类型<span style="color:red;">&nbsp;*</span></label>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="type"
                                               value="{{App\Framework\Enum\ProductTypeEnum::ENTITY}}"
                                               checked="checked">
                                        {{App\Framework\Enum\ProductTypeEnum::getName(App\Framework\Enum\ProductTypeEnum::ENTITY)}}
                                    </label>
                                    <label>
                                        <input type="radio" name="type"
                                               value="{{App\Framework\Enum\ProductTypeEnum::VIRTUAL}}">
                                        {{App\Framework\Enum\ProductTypeEnum::getName(App\Framework\Enum\ProductTypeEnum::VIRTUAL)}}
                                    </label>
                                </div>
                                @if($errors->has('type'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('type')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>兑换价<span style="color:red;">&nbsp;*</span></label>
                                <input type="text" name="ticketNum" class="form-control" style="width:50%;"
                                       placeholder="请填写兑换价">
                                @if($errors->has('ticketNum'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('ticketNum')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>商品状态<span style="color:red;">&nbsp;*</span></label>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="status"
                                               value="{{App\Framework\Enum\ProductStatusEnum::PUTAWAY}}"
                                               checked="checked">
                                        {{App\Framework\Enum\ProductStatusEnum::getName(App\Framework\Enum\ProductStatusEnum::PUTAWAY)}}
                                    </label>
                                    <label>
                                        <input type="radio" name="status"
                                               value="{{App\Framework\Enum\ProductStatusEnum::SOLD_OUT}}">
                                        {{App\Framework\Enum\ProductStatusEnum::getName(App\Framework\Enum\ProductStatusEnum::SOLD_OUT)}}
                                    </label>
                                </div>
                                @if($errors->has('status'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('status')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>商品库存<span style="color:red;">&nbsp;*</span></label>
                                <input type="text" name="stockNum" class="form-control" style="width:50%;"
                                       placeholder="请填写商品库存">
                                @if($errors->has('stockNum'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('stockNum')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>商品图片<span style="color:red;">&nbsp;*</span></label>
                                <input type="file" name="photo" id="photo">
                                <p class="help-block">图片格式不能超过2M，仅支持jpg、jpeg、gif、png格式</p>
                                @if($errors->has('photo'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('photo')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>商品介绍<span style="color:red;">&nbsp;*</span></label>
                                <textarea class="form-control" cols="20" rows="10" name="intro" style="width:50%;"></textarea>
                                @if($errors->has('intro'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('intro')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-default">提交</button>
                                <button type="button" onclick="history.back();" class="btn btn-default">返回</button>
                            </div>
                        </form>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>

@endsection

